class Duck{
    constructor(name){
        this.name = name;
    }
    eat(food){
        console.log(`吃${food}`);
        console.log(this.name)
    }
}
class TangDuck{
    constructor(name){
        this.duck = new Duck(name);
    }
    eat(food){
       this.duck.eat(food);
       console.log("吃完说谢谢");
    }
}

//用
let t  = new TangDuck("他叫小鸭子");
t.eat("水果")